home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWRefCnt / Include / SLRefCnt.xh < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.4 KB  |  204 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: SLRefCnt.xh.
  5.  * Generated using:
  6.  *     SOM Precompiler somipc: 2.18
  7.  *     SOM Emitter emitxh.dll: 2.33
  8.  */
  9.  
  10. /*
  11.  * 
  12.  *     File:        SLRefCnt.idl
  13.  * 
  14.  *     Contains:    Interface for FW_ORefCount class
  15.  *     Release Version:    $ ODF 1 $
  16.  * 
  17.  *     Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  18.  * 
  19.  */
  20.  
  21.  
  22. #ifndef SOM_FW_ORefCount_xh
  23. #define SOM_FW_ORefCount_xh
  24.  
  25. class FW_ORefCount;
  26.  
  27. #define FW_ORefCount_MajorVersion 1
  28. #define FW_ORefCount_MinorVersion 0
  29.  
  30. /*
  31.  * Passthru lines: File: "C.xh", "before"
  32.  */
  33.  
  34.  
  35. /* C++ SOM defs */
  36. #include <somcls.xh>
  37. #include <somcm.xh>
  38.  
  39. /* C++ parent defs */
  40. #ifndef SOM_SOMObject_xh
  41. #include <somobj.xh>
  42. #endif
  43.  
  44. #ifndef FW_ORefCount_API
  45. #define FW_ORefCount_API
  46. /*
  47.  * -- The Class API
  48.  */
  49.  
  50. /*
  51.  * Start of user-defined types:
  52.  */
  53. class SOMClass;
  54. class SOMObject;
  55. class FW_ORefCount;
  56.  
  57. /*
  58.  * End of user-defined types.
  59.  */
  60.  
  61. #ifdef OLDIBMSOMAPISUPPORT
  62. #define FW_ORefCountCClassData FW_ORefCountClassData
  63. #define FW_ORefCountNewClass(major,minor) somNewVersionedClassReference(FW_ORefCount,major,minor)
  64. #endif
  65.  
  66. /* define xxxMetaClass macro to facilitate (cls ## MetaClass) */
  67. #define FW_ORefCountMetaClass SOMClass
  68.  
  69. #if PRAGMA_ALIGN_SUPPORTED
  70. #  pragma options align=power
  71. #endif
  72.  
  73. /* The API to the FW_ORefCount class object, and the methods it introduces. */
  74. SOMEXTERN struct FW_ORefCountClassDataStructure {
  75. #ifdef OLDIBMSOMAPISUPPORT
  76.     SOMClass            *classObject;    /* always zero, use somNewClassReference instead */
  77. #else
  78.     long zero;
  79. #endif
  80.     somStaticClassInfo *sci;
  81.     somDToken        instanceDataToken;
  82.     long reserved [3];
  83.     somMToken somInit;
  84.     somMToken somUninit;
  85.     somMToken Acquire;
  86.     somMToken Release;
  87.     somMToken GetRefCount;
  88. } SOMDLINK FW_ORefCountClassData;
  89.  
  90. #if PRAGMA_ALIGN_SUPPORTED
  91. #  pragma options align=reset
  92. #endif
  93.  
  94. #if !defined(FW_ORefCount_Class_Source) && !defined(SOM_Module_slrefcnt_Source)
  95. #if PRAGMA_IMPORT_SUPPORTED
  96. #pragma import list FW_ORefCountClassData
  97. #endif
  98. #endif
  99.  
  100.  
  101. /*
  102.  * -- Typedefs and inline method declarations for left path inherited methods
  103.  * -- are omitted because this compilation had -museinheritedmethods in effect
  104.  */
  105.  
  106.  
  107. /*
  108.  * -- Typedefs for FW_ORefCount Method Procedures
  109.  */
  110. SOMEXTERN {
  111. typedef void   (* SOMLINK somTD_FW_ORefCount_Acquire)(FW_ORefCount *somSelf, Environment *ev);
  112. typedef long   (* SOMLINK somTD_FW_ORefCount_Release)(FW_ORefCount *somSelf, Environment *ev);
  113. typedef long   (* SOMLINK somTD_FW_ORefCount_GetRefCount)(FW_ORefCount *somSelf, Environment *ev);
  114. }
  115.  
  116. #endif /* FW_ORefCount_API */
  117.  
  118.  
  119. /*
  120.  * -- This emitter treats Method Tokens as Thunks by default.
  121.  * -- Use the sc modifier "nothunks" to change this default
  122.  */
  123. #undef somresolve_
  124. #define somresolve_(obj,mToken) ((somMethodProc*)((void)obj, mToken))
  125.  
  126. /*
  127.  * -- The C++ Wrapper Class for FW_ORefCount
  128.  */
  129. class FW_ORefCount : public SOMObject
  130. {
  131. public:
  132.  
  133. // FW_ORefCount::new registers use of the class object, and then uses somNew
  134. // to allocate memory and load the object method table pointer. 
  135. void *operator new(size_t size)
  136. {
  137.     SOM_IgnoreWarning(size);
  138.     // Allocate memory using the default allocator for FW_ORefCount, and
  139.     // clear mem & set method table pointer, call basic initialization
  140. #ifdef SOMCHKNULL
  141.     void * __somResult = (void *)
  142.       somNewObject(FW_ORefCount);
  143.     SOMCHKNULL(__somResult);
  144.     return __somResult;
  145. #else
  146.     return (void*) somNewObject(FW_ORefCount);
  147. #endif
  148. }
  149.  
  150. // FW_ORefCount::delete uses the default deallocator for the object's class.
  151. void operator delete(void * obj)
  152. {
  153.     if (obj) {
  154.         SOM_Resolve(obj,SOMObject,somFree)
  155.            ( (SOMObject*) obj );
  156.     }
  157. }
  158.  
  159. /* method: Acquire */
  160. void   Acquire(Environment *ev)
  161. {
  162.    SOM_ResolveD(this,FW_ORefCount,FW_ORefCount,Acquire)
  163.     (this,ev);
  164. #ifdef SOMCHKEXCEPT
  165.       SOMCHKEXCEPT;
  166. #endif
  167. }
  168.  
  169. /* method: Release */
  170. long   Release(Environment *ev)
  171. {
  172.    #ifdef SOMCHKEXCEPT
  173.    long __somResult = 
  174.       SOM_ResolveD(this,FW_ORefCount,FW_ORefCount,Release)
  175.     (this,ev);
  176.       SOMCHKEXCEPT;
  177.    return __somResult;
  178. #else
  179.    return SOM_ResolveD(this,FW_ORefCount,FW_ORefCount,Release)
  180.     (this,ev);
  181. #endif
  182. }
  183.  
  184. /* method: GetRefCount */
  185. long   GetRefCount(Environment *ev)
  186. {
  187.    #ifdef SOMCHKEXCEPT
  188.    long __somResult = 
  189.       SOM_ResolveD(this,FW_ORefCount,FW_ORefCount,GetRefCount)
  190.     (this,ev);
  191.       SOMCHKEXCEPT;
  192.    return __somResult;
  193. #else
  194.    return SOM_ResolveD(this,FW_ORefCount,FW_ORefCount,GetRefCount)
  195.     (this,ev);
  196. #endif
  197. }
  198.  
  199. };   /* FW_ORefCount */
  200.  
  201.  
  202.  
  203. #endif       /* SOM_FW_ORefCount_xh */
  204.